<?php
/*
                                    Table "public.hidedtrace"
  Column   |           Type           |                         Modifiers
-----------+--------------------------+-----------------------------------------------------------
 htid      | integer                  | not null default nextval('hidedtrace_tlid_seq'::regclass)
 lati      | double precision         |
 longi     | double precision         |
 elevation | double precision         |
 gid       | integer                  |
 address   | character varying(255)   |
 uid       | integer                  |
 order     | integer                  |
 rdate     | timestamp with time zone |
 mdate     | timestamp with time zone |
 fdate     | timestamp with time zone |
 title     | character varying(255)   |

*/
include "pgsql.class.php";

$objDB = new pgsql();

$uid	= $_REQUEST['uid'];
$tid	= $_REQUEST['tid'];
$lati	= $_REQUEST['lati'];
$longi	= $_REQUEST['longi'];
$ele	= $_REQUEST['ele'];
$address = $_REQUEST['address'];
$title = $_REQUEST['title'];
$gid	= $_REQUEST['gid'];
$orders	= $_REQUEST['orders'];
$gid = $gid ? $gid : 0;
$orders = $orders ? $orders : 0;

$sql	= "INSERT INTO hidedtrace (tid, uid, gid, orders, lati, longi, elevation, rdate, mdate, title, address) ";
$sql	.= " VALUES('$tid', '$uid', '$gid', '$orders', '$lati', '$longi', '$ele', now(), now(), '".$title."','".$address."')";

if($objDB->query($sql)) {
	$sql = "UPDATE trace set hidecnt = hidecnt + 1 WHERE tid = '$tid'";
	if($objDB->query($sql)) {
		echo 1;
	} else {
		echo 0;
	}
} else {
	echo 0;
}
?>